<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Route::get('/', function () {
//    return view('welcome');
//});
Route::get('/', 'PostController@index');
/*
 * 用户模块
 */
//注册
Route::get('/register', 'RegisterController@index');
Route::post('/register', 'RegisterController@register');
//登录
Route::get('/login', 'LoginController@index');
Route::post('/login', 'LoginController@login');
Route::get('/logout', 'LoginController@logout');

Route::group(['middleware' => 'auth:web'], function (){
    //个人设置页面
    Route::get('/user/{user}/setting', 'UserController@setting');
    Route::post('/user/{user}/setting', 'UserController@settingStore');
    //个人中心页面
    Route::get('/user/{user}', 'UserController@show');
    //关注
    Route::get('/user/{user}/fan', 'UserController@fan');
    //取消关注
    Route::get('/user/{user}/unfan', 'UserController@unfan');


    //文章列表页
    Route::get('/posts', 'PostController@index');
    //创建文章
    Route::get('/posts/create', 'PostController@create');
    Route::post('/posts', 'PostController@store');
    //编辑文章
    Route::get('/posts/{post}/edit', 'PostController@edit');
    Route::post('/posts/{post}', 'PostController@update');
    //文章详情页
    Route::get('/posts/{post}', 'PostController@show');
    //删除文章
    Route::get('/posts/{post}/delete', 'PostController@delete');
    //图片上传
    Route::post('/posts/image/upload', 'PostController@imageUpload');

    //提交评论
    Route::post('/posts/{post}/comment', 'PostController@comment');

    //赞
    Route::get('/posts/{post}/zan', 'PostController@zan');
    //取消赞
    Route::get('/posts/{post}/unzan', 'PostController@unzan');

    //专题详情页
    Route::get('/topic/{topic}', 'TopicController@show');

    //投稿
    Route::post('/topic/{topic}/submit', 'TopicController@submit');

    //通知
    Route::get('/notices', 'NoticeController@index');

});


include ("admin.php");

